import axios from 'axios'

const axiosInstance = axios.create()

axiosInstance.defaults.timeout = 50000
axiosInstance.defaults.headers.post['Content-Type'] = 'application/json'

axiosInstance.interceptors.request.use(config => {
  return config
})

axiosInstance.interceptors.response.use(response => {
  return response.data
}, err => {
  if (err && err.response) {
    return Promise.reject(err)
  }
})

export default axiosInstance
